package com.sogoodsoft.web.crm;

import java.util.HashMap;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springside.modules.utils.encode.JsonBinder;
import org.springside.modules.utils.web.struts2.Struts2Utils;

import com.sogoodsoft.entity.crm.Companyinfo;
import com.sogoodsoft.service.common.AbstractService;
import com.sogoodsoft.service.crm.CompanyinfoService;
import com.sogoodsoft.web.BaseAction;

@SuppressWarnings("serial")
public class CompanyinfoAction extends BaseAction<Companyinfo, Long> {

	@Autowired
	private CompanyinfoService service;
	
	private static JsonBinder binder = JsonBinder.buildNonDefaultBinder();
	
	@SuppressWarnings("unchecked")
	@Override
	protected AbstractService getService() {
		return service;
	}
	public String ajax() throws Exception{
		id=1L;
		prepareModel();
		//logger.debug(String.valueOf(entity));
		//logger.debug(entity.getNotice());
		Map<String, Object> map = new HashMap<String, Object>(); 
		map.put("notice", entity.getNotice());
		map.put("other", entity.getOther());
		String json = binder.toJson(map);
		//logger.debug(json);
		Struts2Utils.renderJson(json, "encoding:utf-8");	
		return null;
	}
}
